<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>添加文件</title>
    <script type="text/javascript">
        function addMore(){
            //创建所要添加的元素节点
            var tdElement=document.getElementById('more');
            var fileElement=document.createElement('input');
            fileElement.type='file';
            var buttonElement=document.createElement('input');
            buttonElement.type='button';
            buttonElement.value='remove';
            buttonElement.onclick=function(){
                tdElement.removeChild(fileElement);
                tdElement.removeChild(brElement);
                tdElement.removeChild(buttonElement);
            }
            var brElement=document.createElement('br');
            //把创建的元素节点添加到html文件里
            tdElement.appendChild(fileElement);
            tdElement.appendChild(buttonElement);
            tdElement.appendChild(brElement);
        }
    </script>
</head>
<body>
<form>
    <table align="center" width="60%" border="1" cellspacing="0" cellpadding="0">
        <tr>
            <td>file</td>
            <td id="more">
            <input type="file"/>
            <input type="button" value="Add More..." onclick="addMore()"><br>
            </td>
        </tr>
    </table>
</form>
</body>
</html>